<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page  import="java.util.*"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>使用XMLHttpRequest对象</title>
</head>
<body>
     <center>
        <div>
          <%@include file="top.html" %>
           </div>
           <%
               Date now=new Date();
             %>
             <div>
                 <h3>当前日期时间为:<%=now  %></h3>
                 <hr/>
                 点击歌名查看歌词
                 <input type="button" value="浪子心声" onclick="getLyrics('lzxs')"/>
                  <input type="button" value="暗里着迷" onclick="getLyrics('alzm')"/>
               <br/><br/>
               <span id="showLyrics">
                                       暂时还没有选择歌曲
                </span>
               </div>
           </center>
           <script type="text/javascript">
           var xmlhttp;
           function createXMLHttpRequext(){
        	   if(window.ActiveXObject){
        		   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        	   }else if(window.XMLHttpRequest){
        		   xmlhttp=new XMLHttpRequest();
        	   }
           }
           function getLyrics(songName){
           createXMLHttpRequext();
           
           //xmlhttp.open("GET","dealData.jsp?songName="+songName,true);
           xmlhttp.open("GET","AjaxTest",true);
           xmlhttp.onreadystatechange=returnLyrics;
          xmlhttp.send(null);
          
          
          
           }
           function returnLyrics(){
        	  
        	   if(xmlhttp.readyState==4){
        		   var lyrics=xmlhttp.responseText;
        		   document.getElementById("showLyrics").innerHTML=lyrics;
        	   }
           }
           </script>
</body>
</html>